<?php if(!IS_AJAX){?>

<include file="Public:header" />
<div class="row">


<div class="col-sm-5 col-md-4 col-lg-3">
    <div class="affixelement"><div class="states-info">
      <div class="panel green-bg">
        <div class="panel-body">
          <div class="row">
            <div class="col-xs-3"> <i class="fa fa-hand-o-right"></i> </div>
            <div class="col-xs-7">
              <h4>发布文章</h4>
              <span class="state-title"> <a class="text-success" href="##" onClick="_openWindow('<?php echo U('add');?>', 800, '发布文章', '保存', function(){ $('#ajaxdatalistform').submit();}, '');">点击这里发布文章</a> </span> </div>
            <div class="col-xs-2"> <span class="fa fa-angle-right"></span> </div>
          </div>
        </div>
      </div>
    </div>
    <div class="panel">
      <header class="panel-heading"> 搜索文章 <a href="##" id="ajaxdatalistbob" class="pull-right">批量操作</a></header>
      <div class="panel-body"><div class="form-group" id="ajaxdatalistboc" style="display:none;"><a rel="{:U('delete')}" href="##" class="btn btn-danger bdeleteBtn">删除选中</a></div>
        <form id="ajaxdatalistform">
          <div class="input-group m-bot15">
            <input type="text" name="keywords" placeholder="搜索标题" class="form-control">
            <span class="input-group-btn">
            <button type="button" onClick="$('#ajaxdatalistform').trigger('submit');" class="btn btn-default"><i class="fa fa-search"></i></button>
            </span> </div>
            
            
            <html:dropdownselect class="productselect" name="category" style="height:auto; width:auto;" multi="0" action="{:U('Category/selectCategorylist')}" placeholder="选择栏目" title="选择栏目" />
            
        </form>
        <!--<div id="FlatTree" class="tree tree-plus-minus">
          <div class = "tree-folder" style="display:none;">
            <div class="tree-folder-header"> <i class="fa fa-folder"></i>
              <div class="tree-folder-name"></div>
            </div>
            <div class="tree-folder-content"></div>
            <div class="tree-loader" style="display:none"></div>
          </div>
          <div class="tree-item" style="display:none;"> <i class="tree-dot"></i>
            <div class="tree-item-name"></div>
          </div>
        </div>-->
      </div>
    </div></div>
  </div>

  <div class="col-sm-7 col-md-8 col-lg-9">
    
    
  <div class="panel">
    
    <div class="ajaxdatalist clearfix" id="ajaxdatalist">
      <?php }?>
      <?php if(IS_AJAX){?>
      <!-- 数据主体 -->
      <volist name="list" id="vo">
        <div class="col-sm-6 col-md-6 col-lg-6" id="ajaxdatalist-{$vo.id}">
        
        
        
        
          <div class="panel widget-info-one" style="position:relative;"><div class="BatchOperation BatchOperationBtn">
                <input class="checkbox" type="checkbox" name="id[]" value="{$vo.id}">
                
                
                
                <i class="fa fa-check"></i>
                <div class="fabg"></div>
                
            </div>
            <div class="inner">
              <div class="avatar" style="-webkit-border-radius:0; border-radius:0;"><img alt="" style="border-radius:0;-webkit-border-radius:0;" src="{:getThumbPath($vo['img_url'])}"></div>
              <h5 style="color:#666; height:2em; overflow:hidden;">{$vo.title}</h5>
              <p>栏目：<a href="javascript:void(0);" onClick="_openWindow('<?php echo U('Category/edit', array('id' => $vo['category_id']));?>', 800, '编辑【{$vo.category_name}】', '保存', function(){ $('#ajaxdatalistform').submit();}, '');">{$vo.category_name}</a></p><p style="height:2.6em; overflow:hidden;"><span class="subtitle"> {:cut_str(strip_tags($vo['content']), 30, 0)} </span></p>
              
               
              
              </div>
            <div class="panel-footer">
              <ul class="post-view">
                <li onClick="window.open('{:U('Home/'.$vo['cate_name'].'/'.$vo['id'], array(), true, false, true, __SITEID__)}');"> <a href="javascript:void(0);"> <i class="fa fa-eye"></i> </a> {$vo.click} </li>
                <li class="deleteBtn" data-id="{$vo.id}" rel="{:U('delete', array('id' => $vo['id']))}"> <a href="javascript:void(0);"> <i class="fa fa-trash-o"></i> </a> 删除 </li>
                <li onClick="_openWindow('<?php echo U('edit', array('id' => $vo['id']));?>', 800, '编辑文章', '保存',  function(){ $('#ajaxdatalistform').submit();}, '');" class="active"> <a href="javascript:void(0);"> <i class="fa fa-edit"></i> </a> 编辑 </li>
              </ul>
            </div>
            
            
           
            
          </div>
        </div>
      </volist>
      <?php }?>
      <!-- 数据主体结束 -->
      
      <?php if(!IS_AJAX){?>
      
      </div>
      
      <div id="ajaxdatalistpages" class="center-block pages"></div>
      
      </div>
   
    
  </div>
  
</div>
<include file="Public:footer" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/AdminEX/js/fuelux/css/tree-style.css"/>
<script src="__PUBLIC__/Admin/AdminEX/js/fuelux/js/tree.min.js"></script> 
<script>
$('.productselect').blur(function(e) {
    $('#ajaxdatalistform').trigger('submit');
});
var TreeView = function () {

    return {
        //main function to initiate the module
        init: function () {

            var DataSourceTree = function (options) {
                this._data  = options.data;
                this._delay = options.delay;
            };

            DataSourceTree.prototype = {

                data: function (options, callback) {
                    var self = this;
                    var data = $.extend(true, [], self._data);
					var parent_id = 0;
					if("type" in options && options.type == "folder") {
					   parent_id = options.additionalParameters['id'];			  　　　　
				  　}
				  
				  
				  //请求数据 
				  $.get('{:U('Category/tree')}', {pid:parent_id}, function(data1){
					  callback({ data: data1 });
					  
					  $('#FlatTree .tree-item').unbind('click');
					$('#FlatTree .tree-item').each(function(index, element) {
						
						$(this).click(function(e) {
                            if(!$(this).hasClass('tree-selected')){
							$('#ajaxdatalistform').append('<input type="hidden" value="'+$(this).attr('itemid')+'" class="member_position_id" name="category_id">');
							}else{
								$('#ajaxdatalistform').find('.member_position_id').remove();
							}
							$('#ajaxdatalistform').trigger('submit');
							//document.getElementById('ajaxdatalistform').submit();
                        });
						
						
                        
                    });
					  
					  
				  },'json');
				  
				   
                }
            };

            // INITIALIZING TREE
            var treeDataSource = new DataSourceTree({
                data: [],
                delay: 0
            });

         
		 
		  

            $('#FlatTree').tree({
                dataSource: treeDataSource,
				
                loadingHTML: '<img src="__PUBLIC__/Admin/AdminEX/images/input-spinner.gif"/>',
            });




        }

    };

}();


/*
    jQuery(document).ready(function() {
        TreeView.init();
    });*/

</script>
<style>.widget-info-one{box-shadow:1px 1px 1px #ccc; border:1px solid #ccc; border-left-color:#e2e2e2; border-top-color:#e2e2e2; margin-bottom:15px; padding:4px;}
.states-info i.fa.fa-folder,.states-info i.fa.fa-folder-open,.states-info i.tree-dot{font-size:12px;}
.widget-info-one h5{font-size:16px; line-height:1.75em; height:3.5em;}
.widget-info-one .inner{border:1px solid #eee; border-radius:4px;}.widget-info-one{margin:10px 0;}
</style>



<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.config.js"></script> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.all.min.js"> </script> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/lang/zh-cn/zh-cn.js"></script>



<link href="__PUBLIC__/Admin/css/swfupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/Admin/js/swfupload.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/swfupload.queue.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/fileprogress.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/handlers.js"></script>
</body></html><?php }?>